<template>
	<view class="mine">
		<statusBar />
		<tabbar :current="4"></tabbar>
		<!-- #ifdef MP-WEIXIN -->
		<button class="" @click="wxLogin">微信登录</button>
		<!-- #endif -->
	</view>
</template>
<script>
import { mapActions, mapState } from 'vuex';
import { toast } from '@/utils/toast';
import request from '@/utils/request';
import statusBar from '../../components/statusBar/statusBar.vue';
import tabbar from '../../components/tabbar.vue';
export default {
	components: {
		statusBar,
		tabbar
	},
	data() {
		return {};
	},
	onLoad() {
		uni.login({
			provider: 'weixin',
			success: function(loginRes) {
				console.log('-------获取code-------');
				console.log(loginRes, 77777);
				request('channelApi/login/login?code=' + loginRes.code, 'GET', {}).then(res => {
					console.log(res.data, '结果111');
					uni.setStorage({
						key: 'LOGIN_INFO',
						data: res.data,
						success: function() {
							console.log('success');
						}
					});

					// 获取用户信息
					uni.getUserInfo({
						provider: 'weixin',
						success: function(loginRes) {
							console.log(loginRes.userInfo.userName);
						}
					});
				});
			}
		});
		
	},
	methods: {
		
	}
};
</script>

<style lang="scss" scoped>
.mine {
}
</style>
